home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9040 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: news.ov.com!news
  2. From: glenn@ov.com (Fletcher.Glenn@ov.com)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: preprocessing question
  5. Date: 8 Mar 1996 01:05:41 GMT
  6. Organization: OpenVision
  7. Message-ID: <4ho155$9gi@spanky.pls.ov.com>
  8. References: <313b9e9f.480978@NEWS.CLOUD9.NET>
  9. Reply-To: glenn@ov.com
  10. NNTP-Posting-Host: foghorn.pls.ov.com
  11.  
  12. In article 480978@NEWS.CLOUD9.NET, jalvo@cloud9.net (John G. Alvord) writes:
  13. >I have a couple compilers argument about the following problem:
  14. >
  15. >   #define XXX (1)
  16. >   #include <stdio.h>
  17. >   int main(void)
  18. >   {
  19. >       #if XXX
  20. >           printf("Hello World!");
  21. >       #endif
  22. >       return 0;
  23. >    }
  24. >
  25. >most compilers I have tried preprocess the #if resulting in "#if (1)" and then
  26. >follow that instruction to generate the printf() call.
  27. >
  28. >One compiler (SAS/C 5.50 cross compiler on AIX for MVS) complains that the #if
  29. >line is an illegal constant.  A close reading of the ANSI C standard document
  30. >reveals a clause that seems to imply (my reading) that a pre-processed series
  31. >of tokens that appear to be a preprocessing statement will be ignored. A
  32. >coworker who is more experienced then me feels that the #if does not fall
  33. >under that clause and the #if will be evaluated. His reasoning is that the
  34. >preprocessed series of tokens is just a part of a preprocessing statement.
  35. >
  36. >If someone can shed some light on this, he would make me very happy.
  37. >
  38. >Thanks!
  39. >
  40. >John Alvord
  41.  
  42.  
  43. I know of at least three separate compilers that require that the 
  44. '#' character be in the first column of the source line for
  45. preprocessor directives.
  46.  
  47.             Fletcher.Glenn@ov.com
  48.  
  49.  
  50.